import numpy as np
from matplotlib import pyplot as plt

plt.rcParams['font.sans-serif']=['SimHei']  #用来正常显示中文
plt.rcParams['axes.unicode_minus']=False    #用来正常显示负号

inMeans = (20,25,30,35,27)
outMeans = (25,35,34,20,25)
inStd = (2,3,4,1,2)
outStd = (3,5,2,3,3)
ind = np.arange(5)                        #Bar坐标位置
width = 0.5                               #Bar的宽度

p1 = plt.bar(ind, inMeans, width, yerr=inStd)            #生成两组柱
P2 = plt.bar(ind, outMeans, width, bottom=inMeans, yerr=outStd)

plt.ylabel('分值')
plt.title('不同组用户下国内外用户分值')
plt.xticks(ind, ('组1', '组2', '组3', '组4', '组5'))
plt.yticks(np.arange(0, 81, 10))
plt.legend(("国内","国外"))
plt.show()
